package com.dy.drp.controller;


import com.dy.drp.dto.SaleCollect;
import com.dy.drp.service.ISalelistService;
import com.dy.drp.util.PageUtil;
import com.dy.drp.util.SelectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dy
 * @since 2022-04-01
 */
@RestController
@RequestMapping("/salelist")
@Api(tags = "销售信息列表接口")
public class SalelistController {
    @Autowired
    private ISalelistService salelistService;

    @GetMapping("/selectCollect/{pageNum}/{pageSize}")
    @ApiOperation("单页销售统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "页面展示条数")
    })
    public PageUtil<SaleCollect> selectCollect(@PathVariable("pageNum")Integer pageNum,
                                               @PathVariable("pageSize")Integer pageSize){
        SelectUtil selectUtil = new SelectUtil();
        selectUtil.setPageNum(pageNum);
        selectUtil.setPageSize(pageSize);
        return salelistService.selectCollect(selectUtil);
    }

    @PostMapping("/selectCollectByInfo")
    @ApiOperation("查询单页销售统计")
    public PageUtil<SaleCollect> selectCollectByInfo(SelectUtil selectUtil){
        return salelistService.selectCollectByInfo(selectUtil);
    }
}
